Skip to content

move vue and vue-router to external#1066

Merged
webfansplz merged 2 commits intovuejs:mainfrom
stackoverfloweth:fix/devtools-kit-external-vue-router
Mar 23, 2026
Merged

move vue and vue-router to external#1066
webfansplz merged 2 commits intovuejs:mainfrom
stackoverfloweth:fix/devtools-kit-external-vue-router

Conversation

@stackoverfloweth
Copy link
Copy Markdown

Summary

When @vue/devtools-kit bundles its type declarations via tsdown, it inlines the types from vue-router (a devDependency). This causes vue-router's declare module 'vue' augmentations — specifically the GlobalComponents interface with RouterView and RouterLink — to be embedded in dist/index.d.ts.

This creates type conflicts for any library that also augments GlobalComponents with its own RouterView or RouterLink components (e.g. @kitbag/router). TypeScript's declaration merging requires subsequent property declarations to have the same type, so consumers see errors like:

Caution

TS2717: Subsequent property declarations must have the same type. Property 'RouterView' must be of type '...' but here has type '...'

The same inlining also causes Vue's App type to be duplicated as App$1, leading to type mismatches when passing App instances to setupDevtoolsPlugin.

Fix

Add external: ['vue', 'vue-router'] to the tsdown config for @vue/devtools-kit. This prevents tsdown from inlining their type declarations into the bundled .d.ts output, keeping them as external import(...) references instead. Both packages are already devDependencies — their types should not be bundled.

Test plan

  • Build @vue/devtools-kit and verify dist/index.d.ts no longer contains vue-router's GlobalComponents augmentation
  • Verify downstream projects that augment GlobalComponents with their own router components no longer get TS2717 errors

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 18, 2026

Deploy Preview for vue-devtools-docs canceled.

Name Link
🔨 Latest commit 4cc14c0
🔍 Latest deploy log https://app.netlify.com/projects/vue-devtools-docs/deploys/69baf1dbf5bb7d0007a20bd1

Comment thread packages/devtools-kit/tsdown.config.ts Outdated
Co-authored-by: skirtle <65301168+skirtles-code@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth noting that the problem being fixed here is a regression. The types are built correctly in 8.0.7 but are incorrect for 8.1.0.

I believe the change proposed here is the correct way to get the types back to how they were in 8.0.7.

The problem was introduced by updating tsdown. I believe the underlying cause is sxzz/rolldown-plugin-dts@0fa6905. This appears to be a deliberate change. Previously types were not inlined by default, but now they use the same configuration as the JS build. In the devtools-kit package we only use vue and vue-router for type purposes, so previously they didn't need to be configured as externals.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 23, 2026

Open in StackBlitz

@vue/devtools-applet

npm i https://pkg.pr.new/@vue/devtools-applet@1066

@vue/devtools-core

npm i https://pkg.pr.new/@vue/devtools-core@1066

@vue/devtools

npm i https://pkg.pr.new/@vue/devtools@1066

@vue/devtools-api

npm i https://pkg.pr.new/@vue/devtools-api@1066

@vue/devtools-kit

npm i https://pkg.pr.new/@vue/devtools-kit@1066

@vue/devtools-electron

npm i https://pkg.pr.new/@vue/devtools-electron@1066

@vue/devtools-shared

npm i https://pkg.pr.new/@vue/devtools-shared@1066

@vue/devtools-ui

npm i https://pkg.pr.new/@vue/devtools-ui@1066

vite-plugin-vue-devtools

npm i https://pkg.pr.new/vite-plugin-vue-devtools@1066

commit: 4cc14c0

@webfansplz webfansplz merged commit 6f68bb7 into vuejs:main Mar 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants